#ifndef _ROBOT_SDH_CHANDCLIENT_H_
#define _ROBOT_SDH_CHANDCLIENT_H_

#include <robot/robot.h>
#include <robot/sdh/enums.h>
#include <blackbox/proxies.h>
#include <buola/mat.h>
#include <blackbox/cmethod.h>

namespace buola { namespace robot { namespace sdh {

using namespace buola;

class CHandClient : public blackbox::BBox
{
public:
    CHandClient();
    ~CHandClient();

    void Init(const blackbox::CBoxProxy &pBox=blackbox::CClientProxy("bbhand@saruman")["hand"]);

    void GetPose(mat::CVecNd<7> &pValues);
    void SetGoal(const mat::CVecNd<7> &pJoints);
    void SetGoal(const double *pJoints);
    void SetGoal(int pJ,double pValue);
    void SetVelocity(const mat::CVecNd<7> &pJoints);
    void SetVelocity(int pJ,double pValue);
    void SetCurrent(double pValue);
    
    void Stop();

    bool IsMoving();
    void WaitForStop();

    void Open();
    void Close();

private:
    std::unique_ptr<blackbox::CBoxProxy> mHand;
    blackbox::CArrayIn<double> iJoints;
    blackbox::CDataIn<int> iStatus;
};

/*namespace sdh*/ } /*namespace robot*/ } /*namespace buola*/ }

#endif
